import sys, os, io;

class File:
	def __init__(self, name):
		if type(name) == str:
			self._filename = name;
			self._fd = open(name, "r");
		elif name == sys.stdin:
			self._fd = name;
			self._filename = "";
		elif isinstance(name, io.IOBase):
			self._fd = name;
			self._filename = "";
		self._st = None;
		self._pos = 0;
		self._eoln = False;

	def nextToken(self):
		while (self._st == None or not self.hasMoreTokens()):
			self._st = self._fd.readline().split();
			self._eoln = False;
			self._pos = 0;
		self._pos += 1;
		if self._pos == len(self._st):
			self._eoln = True;
		return self._st[self._pos - 1];

	def hasMoreTokens(self):
		if (self._st == None or self._pos >= len(self._st)): return False;
		else: return True;

	def isEOL(self):
		return self._eoln;

	def close(self):
		self._fd.close();
		self._st = None;
		self._pos = 0;
		self._eoln = False;
	def nextInt(self):
		return int(self.nextToken());

# open streams
inf = File(sys.stdin);
#inf = File("e.in");
out = sys.stdout;
#out = open("e.out", "w");

# reading input data
n = inf.nextInt();
k = inf.nextInt();
a = list();

# some constant for solution
MAXN = 200000;
# reading input values of a[i]
for i in range(k):
	a.append(inf.nextInt());
a.sort();
a.reverse();

# creating matrix dp[MAXN][k][2];
#dp = [[-1 for i in range(k)] for i in range(MAXN)];
dp = dict();

def get(m, i):
	if m not in dp:
		dp[m] = dict();
	if (i not in dp[m]):
		dp[m][i] = -1;
	return dp[m][i];

def go(m, i):
	if m == 0: return 0;
	if i == k:
		return m;
	if m < MAXN and get(m, i) != -1: return dp[m][i];
	res = 0;
	if m < MAXN:
		get(m, i);
		dp[m][i] = 0;
	res = go(m, i + 1) - go(m // a[i], i + 1);
	if m < MAXN:
		dp[m][i] = res;
	return res;


# returning answer
out.write(str(go(n, 0)));
	


